import Taro, { Component, Config } from '@tarojs/taro'
import { ComponentClass } from 'react'
import { View } from '@tarojs/components'
import './index.less'

type PageOwnProps = {
  intectorArrays: number[];
  currentItemId: string;
}
type PageState = {
  pagename: string;

}
type Iprops = PageOwnProps

interface Indector {
  props: Iprops;
  state: PageState;
}
class Indector extends Component {
  constructor(props) {
    super(props);
    this.state = {
      pagename: '指示器',
    }
  }
  //默认的属性值
  static defaultProps = {
    intectorArrays: [1, 2, 3],
  }

  componentWillMount() {
    console.log(this.props.intectorArrays);
  }

  render() {
    return (
      <View className="container">
        {
          this.props.intectorArrays.map((item, index) => {
            let currentItemId = parseInt(this.props.currentItemId);
            return (
              <View key="item" className={currentItemId == index + 1 ? 'indectoritem active' : 'indectoritem'}></View>
            )
          })
        }
      </View>
    )
  }
  renderIndectors = () => {

  }
}
export default Indector as ComponentClass<PageOwnProps, PageState>